<?php

/**
 * ReaderSurveyFeedback form base class.
 *
 * @method ReaderSurveyFeedback getObject() Returns the current form's model object
 *
 * @package    iEasy
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseReaderSurveyFeedbackForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'          => new sfWidgetFormInputHidden(),
      'user_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Users'), 'add_empty' => true)),
      'user_ip'     => new sfWidgetFormInputText(),
      'create_time' => new sfWidgetFormDateTime(),
      'email'       => new sfWidgetFormInputText(),
      'tel'         => new sfWidgetFormInputText(),
      'survey_id'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('ReaderSurvey'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'id'          => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'user_id'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Users'), 'required' => false)),
      'user_ip'     => new sfValidatorString(array('max_length' => 20, 'required' => false)),
      'create_time' => new sfValidatorDateTime(array('required' => false)),
      'email'       => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'tel'         => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'survey_id'   => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('ReaderSurvey'), 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('reader_survey_feedback[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'ReaderSurveyFeedback';
  }

}
